package gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.SwingUtilities;

public class CancelButton extends JButton {
	
	public CancelButton(){
		setText("Cancel");
		addActionListener(new CancelButtonListener(this));
	}

	private class CancelButtonListener implements ActionListener{
		private CancelButton button;
		
		public CancelButtonListener(CancelButton b){
			button = b;
		}
		
		public void actionPerformed(ActionEvent e){
			SwingUtilities.getWindowAncestor(button).dispose();
		}
	}
}
